{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-input-inline layui-form">
                            <select name="h_fix" lay-search="">
                                <option  value="">不限装修</option>
                                <option  value="1">简装</option>
                                <option  value="2">中装</option>
                                <option  value="3">精装</option>
                            </select>
                        </div>
                        <div class="layui-input-inline layui-form">
                            <select name="h_type" lay-search="">
                                <option  value="">不限房屋类型</option>
                                <option  value="1">出租</option>
                                <option  value="2">二手房</option>
                                <option  value="3">新房</option>
                            </select>
                        </div>
                        <div class="layui-input-inline layui-form">
                            <select name="h_shui" lay-search="">
                                <option  value="">不限税费</option>
                                <option  value="1">满2年</option>
                                <option  value="2">满5年</option>
                                <option  value="3">免税</option>
                                <option  value="4">不免税</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="key" class="layui-input search" name="key" value="" placeholder="房屋名称"/>
                        </div>
                        <div style="width: 100%;height: 2px;clear: both"></div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="sheng" lay-search="" id="province"  lay-filter="province">
                                <option value="">---- 请选择省 ----</option>
                                {foreach name="province" item="v1"}
                                <option value="{$v1.district_id}" >{$v1.district}</option>
                                {/foreach}
                            </select>
                        </div>

                        <div class="layui-col-md6 layui-input-inline">
                            <select name="shi" lay-search=""  id="city"  lay-filter="city">
                                <option value="">---- 请选择市 ----</option>
                            </select>
                        </div>

                        <div class="layui-col-md6 layui-input-inline">
                            <select name="qu" lay-search=""  id="district"  lay-filter="district">
                                <option value="">---- 请选择区 ----</option>
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <!--<div class="col-sm-12">-->
                    <!--<div class="input-group" >-->
                        <!--<button class="btn btn-primary" type="button" onclick="wk.href('{:url('add')}');">-->
                            <!--<i class="fa fa-plus"></i> 添加轮播图-->
                        <!--</button>-->
                    <!--</div>-->
                <!--</div>-->
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <ul class="img_view">
                            <li><img src="{{d.photo[0]}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"/></li>
                            {{# if(d.photo.length >= 1){ }}
                            {{# for(var i=1;i<d.photo.length;i++){  }}
                            <li><img src="{{d.photo[i]}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"></li>
                            {{# } }}
                            {{# } }}
                        </ul>
                    </script>
                    <!--类型模板-->
                    <script type="text/html" id="typeTpl">

                    </script>
                    <script type="text/html" id="h_fix">
                        {{# if(d.h_fix == 1){ }}
                        简装
                        {{# } }}
                        {{# if(d.h_fix == 2){ }}
                        中装
                        {{# } }}
                        {{# if(d.h_fix == 3){ }}
                        精装
                        {{# } }}
                        {{# if(d.h_fix == 4){ }}
                        毛坯
                        {{# } }}
                    </script>
                    <script type="text/html" id="h_shui">
                        {{# if(d.h_shui == 1){ }}
                        满2年
                        {{# } }}
                        {{# if(d.h_shui == 2){ }}
                        满5年
                        {{# } }}
                        {{# if(d.h_shui == 3){ }}
                        不满2年
                        {{# } }}
                    </script>
                    <script type="text/html" id="h_kan">
                        {{# if(d.h_shui == 1){ }}
                        随时看房
                        {{# } }}
                        {{# if(d.h_shui == 2){ }}
                        电话预约
                        {{# } }}
                        {{# if(d.h_shui == 3){ }}
                        休息日
                        {{# } }}
                    </script>
                    <script type="text/html" id="h_done">
                        {{# if(d.h_done == 1){ }}
                        未成交
                        {{# } }}
                        {{# if(d.h_done == 2){ }}
                        已成交
                        {{# } }}
                    </script>
                    <script type="text/html" id="viTpl">
                        <div style="width: 260px;height: 200px">
                            <video controls="controls" >
                                <source src="{{d.h_video}}" type="video/mp4" />
                            </video>
                        </div>
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a href="javascript:;" onclick="wk.confirm('{{d.h_id}}','{:url('del')}')" class="btn btn-danger btn-xs m-r-xs" title="删除"><i class="fa fa-trash-o"></i></a>
                        <a href="javascript:;" onclick="wk.href('{:url('update')}?id={{d.h_id}}')" class="btn btn-primary btn-xs m-r-xs" title="编辑"><i class="fa fa-pencil"></i></a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("House/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 80, title: '序号'}
                ,{field:'h_id', width: 80, title: 'ID'}
                ,{field:'h_title', width: 80, title: '房源名称'}
                , {field: 'h_price', width: '', title: '房源价格', align: 'center'}
                , {field: 'h_first', width: 90, title: '房源首付', align: 'center'}
                , {field: 'sheng', width: '80', title: '省', align: 'center'}
                , {field: 'shi', width: '80', title: '市', align: 'center'}
                , {field: 'qu', width: '80', title: '区', align: 'center'}
                , {field: 'h_xiaoqu', width: '', title: '房源位置', align: 'center'}
                , {field: 'h_hx', width: '', title: '户型', align: 'center'}
                , {field: 'h_mianji', width: '', title: '房源面积', align: 'center'}
                , {field: 'disname', width: '', title: '所属小区', align: 'center'}
                , {field: 'h_fix', width: '', title: '装修', align: 'center',templet:'#h_fix'}
                , {field: 'h_shui', width: '', title: '税费', align: 'center',templet:'#h_shui'}
                , {field: 'h_jianjie', width: '', title: '房屋介绍', align: 'center'}
                , {field: 'h_contact', width: '', title: '联系方式', align: 'center'}
                , {field: 'h_price', width: '', title: '租金', align: 'center'}
                , {field: 'photo', width: '', title: '房屋图片', align: 'center',templet:'#imgTpl'}
//                , {field: 'h_video', width: 260, title: '房屋视频', align: 'center',templet:'#viTpl'}
                , {field: 'h_kan', width: '', title: '看房时间', align: 'center',templet:'#h_kan'}
                , {field: 'h_done', width: '', title: '是否成交', align: 'center',templet:'#h_done'}
                , {fixed: 'right', width: 100, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img_view').viewer();
            }
        });
    });
</script>
</body>
</html>